function Goods(){} // 商品楼层的渲染
$.extend(Goods.prototype,{
    init : function(data){
        this.url = "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1563989245692&di=29844d8b10dace46dff24fe2014da761&imgtype=0&src=http%3A%2F%2Fspider.nosdn.127.net%2F2964c767d5798be6c8f83739fb5689b9.gif";
        var goods_html = this.render(data);
        return goods_html;
    },
    render:function(data){
        var html = "";
        for(var i = 0 ,floor_name;floor_name =data[i];i ++ ){
            var html_sub = "";
            for(var k=0, sub;sub =floor_name.subtitle[k];k ++){
                html_sub += `
                <a href="#">${sub}</a>
                `
            }
            var html_goods = "";
            for(var j = 0 ,goods;goods =floor_name.goods[j];j ++ ){
                html_goods += `
                <div class="floor_item" dataid = "${goods["dataid"]}">
                    <a href="../html/goods.html#${goods["dataid"]}" target="_blank" class="pro_img" data-img = ${goods.pathimg}>
                        <img src="${this.url}" alt="${goods.title}">
                    </a>
                    <a href="../html/goods.html#${goods["dataid"]}" target="_blank" class="pro_name"> 
                        ${goods.title}
                    </a>
                    <a href="../html/goods.html#${goods["dataid"]}" target="_blank" class="pro_description">
                        ${goods.item}
                    </a>
                    <p>
                        <a href="../html/goods.html#${goods["dataid"]}" target="_blank" class="pro_price">
                            ￥${goods.price}
                        </a>
                    </p>
                    <span class="${goods.state}"></span>
                </div>
                `
            }
            html += `
        <div class="floor_box clear">
            <div class="floor_title">
                <h3>${floor_name.floorName}</h3>
                <div class="floor_links">
                    ${html_sub}
                    <a href="#" class="floor_more">更多</a>
                </div>
            </div>
            <div class="floor_img">
                <div class="floor_left">
                    <a href="#">
                        <img src="${floor_name.rightImg}">
                    </a>
                </div>
                <div class="floor_right">
                    ${html_goods}
                </div>
            </div>
        </div>
            
            `
        }
        return html;
    }
})




export default new Goods();